Dim myArr
'myArr = testArr()
'For i = 0 To 5
	'Wscript.echo myArr(i)
'Next
Dim htmSurfixNames
Dim arr1
htmSurfixNames=Array("htm")
Set fso = CreateObject("Scripting.FileSystemObject")
Set typeFolder=fso.GetFolder("D:\myprojects\vsprojects\vbscriptsproj\vbscriptsproj\15092011\ITQ")
Set allSubFiles=typeFolder.Files
arr1=getFilesWithSurfixArr(allSubFiles,htmSurfixNames)






Function testArr ()
	Dim arr()
	ReDim arr(5)
    For i = 0 To 5
	   arr(i)=i
	Next
	testArr=arr	
End Function

Function getFilesWithSurfixArr(files,surfixNames)
    Dim length
	Dim arr()
    length=0
	ReDim arr(length)
    Dim objFileExtension
    For Each objFile in files
        objFileExtension = fso.GetExtensionName(objFile.Name)
        
        For Each surfixName in surfixNames
            If surfixName=objFileExtension Then
			    Wscript.Echo objFileExtension
			    Wscript.Echo objFile.Name
				
				If  length > 0 Then
					Dim tmpArr
					tmpArr=arr
					ReDim arr(length)
					For i=0 to (length-1)
						arr(i)=tmpArr(i)
					Next
				End If
				
				arr(length)=objFile.Name
                length=length+1
                Exit For
            End If
        Next
    Next
	For Each fileName In  arr
		Wscript.echo fileName
	Next
	Wscript.echo UBound(arr)
    getFilesWithSurfixArr=arr
End Function